package com.peas.platform.module.icims.budget.ysy.component;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.peas.platform.module.icims.budget.project.dto.*;
import com.peas.platform.module.icims.budget.ysy.dto.BudgetYsyLoginDto;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Slf4j
@Component
public class BudgetYsyGuangzhouClient {

    /**
     *
     * @param url "http://ctglqscwg.gdczt.gov.cn/dgduias/auth/pwd?redirect=http://ctglqscwg.gdczt.gov.cn/ysy_guangzhou/"
     * @param username "11-607001wsy"
     * @param password "MtVdHm9iIez7wudhvwyG35XTYjb8MRakYcJLPm0XSfi8XB7n1uRIPSj8%2BdLuNaMyf7AoIWTnM8U0dDxmY%2BGCu58mSUYlyHCP8v8fJQcGrQ%2FZ9aXTwAw5AHVW3G25CiQOi9SMCAoJT6Dvcd0y1BDpc5kBh654IF%2B3mPekftFL%2B%2BRHQsfEjc20CEBYmzVoOc9arEtNBDpXKpqwb9CQ4SS0Pr9H5CFkLAwMq6QkJ8qbqD9pdNSNNGN%2FTMlOrh8IG%2BSpl5yd%2FB0QWPcg5jhWHCNAgFKKAVUeXG8jPfczTA40T87NMKreoAqJP7gjabx%2FJumjkpnkG1TpJAs1VtRrQsEGPg%3D%3D"
     * @return YsyLoginDto
     */
    @SneakyThrows
    public BudgetYsyLoginDto login(String url, String username, String password) {
        //http://ctglqscwg.gdczt.gov.cn/dgduias/auth/pwd?password=MtVdHm9iIez7wudhvwyG35XTYjb8MRakYcJLPm0XSfi8XB7n1uRIPSj8%2BdLuNaMyf7AoIWTnM8U0dDxmY%2BGCu58mSUYlyHCP8v8fJQcGrQ%2FZ9aXTwAw5AHVW3G25CiQOi9SMCAoJT6Dvcd0y1BDpc5kBh654IF%2B3mPekftFL%2B%2BRHQsfEjc20CEBYmzVoOc9arEtNBDpXKpqwb9CQ4SS0Pr9H5CFkLAwMq6QkJ8qbqD9pdNSNNGN%2FTMlOrh8IG%2BSpl5yd%2FB0QWPcg5jhWHCNAgFKKAVUeXG8jPfczTA40T87NMKreoAqJP7gjabx%2FJumjkpnkG1TpJAs1VtRrQsEGPg%3D%3D&redirect=http%3A%2F%2Fctglqscwg.gdczt.gov.cn%2Fysy_guangzhou%2F&account=11-607001wsy
        BudgetYsyLoginDto info = new BudgetYsyLoginDto();
        String url1 = url;
        url1 = url1 + "&account=" + username;
        url1 = url1 + "&password=" + password;
        HttpRequest req = HttpUtil.createGet(url1);
        req.disableCache();
        req.disableCookie();
        req.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7");
        req.header("Accept-Encoding", "gzip, deflate");
        req.header("Accept-Language", "zh-CN,zh;q=0.9");
        req.header("Connection", "keep-alive");
        req.header("Content-Type", "application/x-www-form-urlencoded");
        req.header("Host", "ctglqscwg.gdczt.gov.cn");
        HttpResponse resp1 = req.execute(false);
        log.info("-----------------------------");
        log.info("resp1:" + JSONUtil.toJsonStr(resp1));
        log.info("-----------------------------");
        String storecode = resp1.header("Set-Cookie").split(";")[0].split("=")[1];
        info.setStorecode(storecode);
        if (resp1.getStatus() == 302) {
            String url2 = resp1.header("Location");
            req.setUrl(url2);
            req.cookie("storecode=" + info.getStorecode());
            HttpResponse resp2 = req.execute(false);
            log.info("-----------------------------");
            log.info("resp2:" + JSONUtil.toJsonStr(resp2));
            log.info("-----------------------------");
            List<String> list = resp2.headerList("Set-Cookie");
            for (String s : list) {
                if (StrUtil.equalsIgnoreCase("SESSIONID2", s.split(";")[0].split("=")[0])) {
                    String sessionid2 = s.split(";")[0].split("=")[1];
                    info.setSessionid2(sessionid2);
                }
                if (StrUtil.equalsIgnoreCase("LTPATOKEN", s.split(";")[0].split("=")[0])) {
                    String ltpatoken = s.split(";")[0].split("=")[1];
                    info.setLtpatoken(ltpatoken);
                }
                if (StrUtil.equalsIgnoreCase("dgd_wwlid", s.split(";")[0].split("=")[0])) {
                    String dgd_wwlid = s.split(";")[0].split("=")[1];
                    info.setDgdWwlid(dgd_wwlid);
                }
            }
            String cookie = info.getStorecode() + "; dgd_wwlid=" + info.getDgdWwlid() + "; LTPATOKEN=" + info.getLtpatoken() + "; SESSIONID2=" + info.getSessionid2();
            if (resp2.getStatus() == 302) {
                String url3 = resp2.header("Location");
                req.setUrl(url3);
                req.cookie("storecode=" + info.getCookie());
                HttpResponse resp3 = req.execute(false);
                log.info("-----------------------------");
                log.info("resp3:" + JSONUtil.toJsonStr(resp3));
                log.info("-----------------------------");
            }
        }

        String url4 = "http://ctglqscwg.gdczt.gov.cn/dgd/auth/session/get/";
        Map<String, String> header4 = new HashMap<>();
        header4.put("Content-Type", "application/x-www-form-urlencoded");
        header4.put("Host", "ctglqscwg.gdczt.gov.cn");
        HttpRequest req4 = HttpUtil.createGet(url4);
        req4.cookie("storecode=" + info.getCookie());
        req4.headerMap(header4, true);
        HttpResponse resp4 = req4.execute();
        log.info("-----------------------------");
        log.info("resp4:" + JSONUtil.toJsonStr(resp4));
        log.info("-----------------------------");
        JSONObject o4 = JSONUtil.parseObj(resp4.body());
        String userid = o4.getJSONObject("data").getStr("userid");
        info.setUserid(userid);

        String url5 = "http://ctglqscwg.gdczt.gov.cn/ysy_guangzhou/be-budget-config/centerhomepage/getUserByToken?" + System.currentTimeMillis();
        HttpRequest req5 = HttpUtil.createPost(url5);
        req5.cookie("storecode=" + info.getCookie());
        req5.contentType("application/json;charset=UTF-8");
        req5.header("Host", "ctglqscwg.gdczt.gov.cn");
        req5.header("requestNo", String.valueOf(System.currentTimeMillis()));
        req5.header("Tokenid", info.getUserid());
        System.out.println(req5);
        req5.body("{}");
        HttpResponse resp5 = req5.execute();
        System.out.println(resp5);
        System.out.println("-----------------------------");
        JSONObject o5 = JSONUtil.parseObj(resp5.body());
//        info.curYear = o5.getStr("year");
        String curRoleId = o5.getJSONArray("authRoles").getJSONObject(0).getStr("roleId");
        info.setCurRoleId(curRoleId);
        String tokenid = info.getUserid() + "#" + info.getCurRoleId() + '#' + info.getCurYear();
        info.setTokenid(tokenid);
        info.setMenuCode("200001");
        return info;
    }

    public void creation(BudgetYsyLoginDto info, BudgetProjectTwoDto dto, List<BudgetProjectTwoItemDto> items, List<BudgetProjectTwoYearDto> years, List<BudgetProjectTwoKpiDto> kpis, List<BudgetProjectTwoFileDto> files) {
        String url = "http://ctglqscwg.gdczt.gov.cn/ysy_guangzhou/be-project/api/project-library/second-level/creation?" + System.currentTimeMillis();
        Map<String, String> header = new HashMap<>();
        header.put("Host", "ctglqscwg.gdczt.gov.cn");
//        header.put("Connection", "keep-alive");
        header.put("requestNo", String.valueOf(System.currentTimeMillis()));
        header.put("nodeType", "0");
//        header.put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 SE 2.X MetaSr 1.0");
        header.put("mof_div_code", "440111000");
        header.put("apiName", "【项目综合管理(预算单位经办岗)】【待办】【新增二级项目】");
        header.put("Content-Type", "application/json;charset=UTF-8");
        header.put("Accept", "*/*");
        header.put("operationType", "预算域_项目综合管理(预算单位经办岗)_待办_新增二级项目");
        header.put("buttonsize", "1");
//        header.put("X-Requested-With", "XMLHttpRequest");
        header.put("menuCode", info.getMenuCode());
        header.put("tokenid", info.getTokenid());
        header.put("pageLabel", "1");
//        header.put("Origin", "http://ctglqscwg.gdczt.gov.cn");
//        header.put("Referer", "http://ctglqscwg.gdczt.gov.cn/ysy_guangzhou/boss/project/html/projectManage.html?menuguid=" + info.menuCode + "&tokenid=" + info.userid);
//        header.put("Accept-Encoding", "gzip, deflate");
//        header.put("Accept-Language", "zh-CN,zh;q=0.9");
        String data = "{\"regionCode\":\"440111000\",\"regionName\":\"白云区\",\"fiscalYear\":\"2024\",\"userId\":\"" + info.getUserid() + "\",\"appCode\":\"440100000_ysy_2024\",\"roleId\":\"1031531166320300032\",\"preUrl\":\"/ysy_guangzhou\",\"realName\":\"吴世源\",\"userName\":\"11-607001wsy\",\"isStamp\":1,\"stampUserCheck\":1,\"isGateWay\":1,\"condFlag\":1,\"userTypeCode\":\"agency\",\"ischeckUK\":0,\"handleMax\":0,\"importMax\":50,\"orgName\":\"广州高新技术产业开发区民营科技园管理委员会\",\"orgCode\":\"440111000_Agency_607001\",\"orgId\":\"981573002108080129\"}";
        Assert.notBlank(info.getStorecode());
        Assert.notBlank(info.getDgdWwlid());
        Assert.notBlank(info.getLtpatoken());
        Assert.notBlank(info.getSessionid2());
//        header.put("Cookie", "oauth2_authentication_csrf=" + info.oauth2_authentication_csrf + "; tif.atlas.auth=" + info.tif_atlas_auth + "; storecode=" + info.storecode + "; dgd_wwlid=" + info.dgd_wwlid + "; LTPATOKEN=" + info.ltpatoken + "; SESSIONID2=" + info.sessionid2 + "; zk_dgd_wwlid=" + info.zk_dgd_wwlid + "; data=" + data);
        Map<String, Object> body = new HashMap<>();
        body.put("isSn", "0");
        body.put("operateType", "add");
        body.put("isStartWflow", "1");
        body.put("isMoreTempSave", false);
        body.put("approveNode", "0");
        body.put("isaudit", false);
        body.put("isSaveAndSubmit", false);
        body.put("isTempSave", true);
        body.put("isTempData", false);

        Map<String, Object> projectBaseInfo = new HashMap<>();//TODO
        //项目分类
        projectBaseInfo.put("pro_cat_code", "331");
        projectBaseInfo.put("pro_cat_id", "fa20d195f12a401f9d15ddcb94ae2024");
        projectBaseInfo.put("pro_cat_name", "部门预算部门职能类");
        //一级项目
        projectBaseInfo.put("level_one_pro_code", "440111210000000029770");
        projectBaseInfo.put("level_one_pro_name", "部门预算部门职能经费");
        //主管部门
        projectBaseInfo.put("mgt_dept_code", "607");
        projectBaseInfo.put("mgt_dept_id", "42023b9bc6b043c08ce023b941ee2024");
        projectBaseInfo.put("mgt_dept_name", "广州高新技术产业开发区民营科技园管理委员会(部门)");
        //
        projectBaseInfo.put("mgt_mof_dep_code", "007");
        projectBaseInfo.put("mgt_mof_dep_id", "34dd4692bf034b6aa929713b1aab2024");
        projectBaseInfo.put("mgt_mof_dep_name", "行三科");
        //存续状态
        projectBaseInfo.put("exist_statue_code", "2");
        projectBaseInfo.put("exist_statue_id", "c9832eac0a46423fa4c7480cfdfa2024");
        projectBaseInfo.put("exist_statue_name", "阶段性");
        //ProjectLevel
        projectBaseInfo.put("fincal_level_code", "5");
        projectBaseInfo.put("fincal_level_id", "e1475bba60db4178bc5ee2093ec72024");
        projectBaseInfo.put("fincal_level_name", "县（区）级");

        projectBaseInfo.put("cen_tra_pro_code", "");
        projectBaseInfo.put("degisn_consideration", "55555");
        projectBaseInfo.put("level_one_pro_id", "112809594530562049");
        //
        projectBaseInfo.put("dept_code", "607");
        projectBaseInfo.put("dept_", "42023b9bc6b043c08ce023b941ee2024");
        Map<String, Object> mgt_dept = new HashMap<>();
        mgt_dept.put("id", "42023b9bc6b043c08ce023b941ee2024");
        mgt_dept.put("code", "607");
        mgt_dept.put("name", "广州高新技术产业开发区民营科技园管理委员会(部门)");
        projectBaseInfo.put("mgt_dept_", mgt_dept);

        projectBaseInfo.put("mof_dep_code", "007");
        projectBaseInfo.put("mof_dep_id", "34dd4692bf034b6aa929713b1aab2024");
        projectBaseInfo.put("mof_dep_", "34dd4692bf034b6aa929713b1aab2024");
        projectBaseInfo.put("mof_dep_name", "行三科");

        Map<String, Object> mgt_mof_dep = new HashMap<>();
        mgt_mof_dep.put("id", "34dd4692bf034b6aa929713b1aab2024");
        mgt_mof_dep.put("code", "007");
        mgt_mof_dep.put("name", "行三科");
        projectBaseInfo.put("mgt_mof_dep_", mgt_mof_dep);

        projectBaseInfo.put("agency_", "607001");
        projectBaseInfo.put("agency_id", "0a5036321a5047d88dfdcdead3fa2024");
        projectBaseInfo.put("agency_code", "607001");
        projectBaseInfo.put("agency_name", "广州高新技术产业开发区民营科技园管理委员会");

        projectBaseInfo.put("userType", "Agency");
        projectBaseInfo.put("create_by_id", "831934955176333312");
        projectBaseInfo.put("create_by", "吴晨茜");
        projectBaseInfo.put("apply_link_man", "吴晨茜");
        projectBaseInfo.put("apply_link_tel", "13820359121");

        projectBaseInfo.put("exist_statue_", "2");
        projectBaseInfo.put("pro_start_year", "2024");
        projectBaseInfo.put("pro_source_", "1");
        projectBaseInfo.put("pro_nature_", "1");
        projectBaseInfo.put("pro_total_amt", "715500.00");
        projectBaseInfo.put("scoi_invest_fund", "0.00");
        projectBaseInfo.put("effective_amt", "65500.00");
        projectBaseInfo.put("his_bgt", "0.00");
        projectBaseInfo.put("is_bond_", "1");
        projectBaseInfo.put("is_asset", "1");
        projectBaseInfo.put("pro_total_sum_amt", "715500.00");
        projectBaseInfo.put("is_captial_cons_pro", "0");
        Map<String, Object> pro_cat = new HashMap<>();
        pro_cat.put("id", "fa20d195f12a401f9d15ddcb94ae2024");
        pro_cat.put("code", "331");
        pro_cat.put("name", "部门预算部门职能类");
        projectBaseInfo.put("pro_cat_", pro_cat);
        Map<String, Object> fincal_level = new HashMap<>();
        fincal_level.put("id", "e1475bba60db4178bc5ee2093ec72024");
        fincal_level.put("code", "5");
        fincal_level.put("name", "县（区）级");
        projectBaseInfo.put("fincal_level_", fincal_level);
        projectBaseInfo.put("pro_name", "auto" + System.currentTimeMillis());
        projectBaseInfo.put("end_year", "2025");
        projectBaseInfo.put("use_money_agency_", "607001");
        projectBaseInfo.put("is_scientific", "0");
        projectBaseInfo.put("pro_desc", "5555");
        projectBaseInfo.put("use_money_agency", "607001");
        projectBaseInfo.put("use_money_agency_id", "0a5036321a5047d88dfdcdead3fa2024");
        projectBaseInfo.put("use_money_agency_name", "广州高新技术产业开发区民营科技园管理委员会");
        projectBaseInfo.put("use_money_agency_code", "607001");
        projectBaseInfo.put("pro_nature", "1");
        projectBaseInfo.put("pro_nature_id", "02e644d4153c4e63be614d2a77492024");
        projectBaseInfo.put("pro_nature_name", "新增项目");
        projectBaseInfo.put("pro_nature_code", "1");
        projectBaseInfo.put("is_bond", "1");
        projectBaseInfo.put("is_bond_id", "ba5e124c43004b558beb045b6bb32024");
        projectBaseInfo.put("is_bond_name", "非债券类项目");
        projectBaseInfo.put("is_bond_code", "1");
        projectBaseInfo.put("exist_statue", "2");
        projectBaseInfo.put("pro_source", "1");
        projectBaseInfo.put("pro_source_id", "f9ae643c94da4079a101109e79e22024");
        projectBaseInfo.put("pro_source_name", "本级申报项目");
        projectBaseInfo.put("pro_source_code", "1");
        projectBaseInfo.put("exploit_agency_", "0");
        projectBaseInfo.put("his_pro_name", null);
        projectBaseInfo.put("is_major_pro", "0");
        projectBaseInfo.put("agency", "607001");
        projectBaseInfo.put("approveNode", "0");
        projectBaseInfo.put("is_audit", "0");
        projectBaseInfo.put("is_construction", "0");
        projectBaseInfo.put("construction_agency", "");
        projectBaseInfo.put("construction_agency_code", "");
        projectBaseInfo.put("construction_agency_name", "");
        projectBaseInfo.put("construction_agency_id", "");

        List<Map<String, Object>> annualexpPlanInfos = new ArrayList<>();//TODO
        Map<String, Object> annualexpPlanInfo1 = new HashMap<>();
        annualexpPlanInfo1.put("plan_year", "2024");
        annualexpPlanInfo1.put("declaration_amt", "65500");
        annualexpPlanInfo1.put("pro_lv2_sum_declara_amt", 0);
        annualexpPlanInfo1.put("pro_lv2_sum_amt", 0);
        annualexpPlanInfo1.put("thr_sec_id", "92283302f13e4feca9ca30d81e0da947");
        annualexpPlanInfo1.put("thr_sec_code", "E02");
        annualexpPlanInfo1.put("thr_sec_name", "（二）其他非“三保”支出");
        annualexpPlanInfo1.put("_XID", "row_987");
        Map<String, Object> oriRow1 = new HashMap<>();
        oriRow1.put("plan_year", "2024");
        oriRow1.put("dept_check_amt", 0);
        oriRow1.put("check_amt", 0);
        oriRow1.put("is_thrsec_fund", "0");
        oriRow1.put("declaration_amt", "65500");
        oriRow1.put("pro_lv2_sum_declara_amt", 0);
        oriRow1.put("pro_lv2_sum_amt", 0);
        oriRow1.put("thr_sec_id", "92283302f13e4feca9ca30d81e0da947");
        oriRow1.put("thr_sec_code", "E02");
        oriRow1.put("thr_sec_name", "（二）其他非“三保”支出");
        oriRow1.put("_XID", "row_987");
        oriRow1.put("mof_dep_check_amt", 0);
        oriRow1.put("isRefreshCurRow", false);
        oriRow1.put("thr_sec_", "92283302f13e4feca9ca30d81e0da947");
        oriRow1.put("thr_sec", "E02");
        annualexpPlanInfo1.put("oriRow", oriRow1);
        annualexpPlanInfo1.put("dept_check_amt", 0);
        annualexpPlanInfo1.put("check_amt", 0);
        annualexpPlanInfo1.put("is_thrsec_fund", "0");
        annualexpPlanInfo1.put("mof_dep_check_amt", 0);
        annualexpPlanInfo1.put("isRefreshCurRow", true);
        annualexpPlanInfo1.put("thr_sec_", "E02-（二）其他非“三保”支出");
        annualexpPlanInfo1.put("thr_sec", "E02");
        annualexpPlanInfo1.put("hot_topic_cate_", "");
        annualexpPlanInfo1.put("hot_topic_cate_id", "");
        annualexpPlanInfo1.put("hot_topic_cate_code", "");
        annualexpPlanInfo1.put("hot_topic_cate_name", "");
        annualexpPlanInfo1.put("hot_topic_cate_mult", new ArrayList<>());
        annualexpPlanInfo1.put("effective_amt", "65500");
        annualexpPlanInfo1.put("pro_hot_topics", new ArrayList<>());
        Map<String, Object> annualexpPlanInfo2 = new HashMap<>();
        annualexpPlanInfo2.put("plan_year", "2025");
        annualexpPlanInfo2.put("declaration_amt", "650000");
        annualexpPlanInfo2.put("pro_lv2_sum_declara_amt", 0);
        annualexpPlanInfo2.put("pro_lv2_sum_amt", 0);
        annualexpPlanInfo2.put("_XID", "row_1024");
        Map<String, Object> oriRow2 = new HashMap<>();
        oriRow2.put("plan_year", "2025");
        oriRow2.put("dept_check_amt", 0);
        oriRow2.put("check_amt", 0);
        oriRow2.put("declaration_amt", "650000");
        oriRow2.put("pro_lv2_sum_declara_amt", 0);
        oriRow2.put("pro_lv2_sum_amt", 0);
        oriRow2.put("_XID", "row_1024");
        oriRow2.put("mof_dep_check_amt", 0);
        oriRow2.put("thr_sec_", "");
        oriRow2.put("thr_sec_id", "");
        oriRow2.put("thr_sec_code", "");
        oriRow2.put("thr_sec_name", "");
        oriRow2.put("thr_sec", "");
        oriRow2.put("isRefreshCurRow", true);
        annualexpPlanInfo2.put("oriRow", oriRow2);
        annualexpPlanInfo2.put("dept_check_amt", 0);
        annualexpPlanInfo2.put("check_amt", 0);
        annualexpPlanInfo2.put("mof_dep_check_amt", 0);
        annualexpPlanInfo2.put("isRefreshCurRow", false);
        annualexpPlanInfo2.put("thr_sec_", "");
        annualexpPlanInfo2.put("thr_sec_id", "");
        annualexpPlanInfo2.put("thr_sec_code", "");
        annualexpPlanInfo2.put("thr_sec_name", "");
        annualexpPlanInfo2.put("thr_sec", "");
        annualexpPlanInfo2.put("hot_topic_cate_", "");
        annualexpPlanInfo2.put("hot_topic_cate_id", "");
        annualexpPlanInfo2.put("hot_topic_cate_code", "");
        annualexpPlanInfo2.put("hot_topic_cate_name", "");
        annualexpPlanInfo2.put("hot_topic_cate_mult", new ArrayList<>());
        annualexpPlanInfo2.put("effective_amt", "650000");
        annualexpPlanInfo2.put("pro_hot_topics", new ArrayList<>());
        annualexpPlanInfos.add(annualexpPlanInfo1);
        annualexpPlanInfos.add(annualexpPlanInfo2);

        List<Map<String, Object>> projectAttachments = new ArrayList<>();//TODO
        Map<String, Object> projectAttachment = new HashMap<>();
        projectAttachment.put("attath_name", "其他特定目标类-部门职能类二级项目导入_V20230509093956.xlsx");
        projectAttachment.put("pro_attach_type_", "02-资金需求");
        projectAttachment.put("file_size", "34400");
        projectAttachment.put("file_id", "1a18f8136d0b46ad9e5b5972f6c7008a");
        projectAttachment.put("file_type", ".xlsx");
        projectAttachment.put("file_name", "其他特定目标类-部门职能类二级项目导入_V20230509093956.xlsx");
        projectAttachment.put("is_invest_file", "0");
        projectAttachment.put("file_upload_time", "2023-08-11 09:48:27");
        projectAttachment.put("file_upload_year", 2024);
        projectAttachment.put("_XID", "row_11256");
        Map<String, Object> oriRow3 = new HashMap<>();
        oriRow3.put("file_name", "其他特定目标类-部门职能类二级项目导入_V20230509093956.xlsx");
        oriRow3.put("pro_attach_type_", "cb626bcd85634acd8b3e7b45c3dc2024");
        oriRow3.put("pro_attach_type_id", "cb626bcd85634acd8b3e7b45c3dc2024");
        oriRow3.put("pro_attach_type_code", "02");
        oriRow3.put("pro_attach_type_name", "资金需求");
        oriRow3.put("pro_attach_type", "02");
        oriRow3.put("attath_name", "其他特定目标类-部门职能类二级项目导入_V20230509093956.xlsx");
        oriRow3.put("file_size", "34400");
        oriRow3.put("file_id", "1a18f8136d0b46ad9e5b5972f6c7008a");
        oriRow3.put("file_type", ".xlsx");
        oriRow3.put("is_invest_file", "0");
        oriRow3.put("file_upload_time", "2023-08-11 09:48:27");
        oriRow3.put("file_upload_year", 2024);
        oriRow3.put("_XID", "row_11256");
        projectAttachment.put("oriRow", oriRow3);
        projectAttachment.put("pro_attach_type_id", "cb626bcd85634acd8b3e7b45c3dc2024");
        projectAttachment.put("pro_attach_type_code", "02");
        projectAttachment.put("pro_attach_type_name", "资金需求");
        projectAttachment.put("pro_attach_type", "02");
        projectAttachment.put("isRefreshCurRow", true);
        projectAttachments.add(projectAttachment);

        List<Map<String, Object>> proEstimate = new ArrayList<>();//TODO
        Map<String, Object> proEstimat = new HashMap<>();

        proEstimate.add(proEstimat);

        List<Map<String, Object>> labelRegistrations = new ArrayList<>();
        List<Map<String, Object>> proHotTopics = new ArrayList<>();
        List<Map<String, Object>> buildProTypes = new ArrayList<>();
        Map<String, Object> orderInfo = new HashMap<>();
        List<Map<String, Object>> investAudits = new ArrayList<>();
        List<Map<String, Object>> projectPerfInfos = new ArrayList<>();
        Map<String, Object> projectPerfInfo = new HashMap<>();
        projectPerfInfo.put("kpi_target", dto.getTargetAll());//
        projectPerfInfo.put("year_performance_target", dto.getTargetCurrent());//
        projectPerfInfo.put("fiscal_year", "2024");
        projectPerfInfos.add(projectPerfInfo);

        List<Map<String, Object>> projectPerfKpis = new ArrayList<>();//TODO
        Map<String, Object> projectPerfKpi = new HashMap<>();

        projectPerfKpis.add(projectPerfKpi);

        List<Map<String, Object>> perfImplPlan = new ArrayList<>();
        body.put("projectBaseInfo", projectBaseInfo);
        body.put("annualexpPlanInfos", annualexpPlanInfos);
        body.put("projectAttachments", projectAttachments);
        body.put("proEstimate", proEstimate);
        body.put("labelRegistrations", labelRegistrations);
        body.put("proHotTopics", proHotTopics);
        body.put("buildProTypes", buildProTypes);
        body.put("orderInfo", orderInfo);
        body.put("investAudits", investAudits);
        body.put("peculiarInfo", null);
        body.put("projectPerfInfos", projectPerfInfos);
        body.put("projectPerfKpis", projectPerfKpis);
        body.put("perfImplPlan", perfImplPlan);
        HttpRequest req = HttpUtil.createPost(url);
        req.cookie("storecode=" + info.getCookie());
        req.headerMap(header, true);
        req.contentType("application/json;charset=UTF-8");
        req.body(JSONUtil.toJsonStr(body));
//        System.out.println(req);
        HttpResponse resp = req.execute();
        System.out.println(resp);
//        String resp = httpClientCall.post("ysy", url, JSONUtil.toJsonStr(body), "application/json;charset=UTF-8", header);
    }

    public void updating(BudgetYsyLoginDto info) {
        String url = "http://ctglqscwg.gdczt.gov.cn/ysy_guangzhou/be-project/api/project-library/second-level/updating?" + System.currentTimeMillis();
    }

}
